package com.unionx.unionxuf.service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.unionx.unionxuf.common.TransformerStr;
import com.unionx.unionxuf.entity.ProjectDTD;
import com.unionx.unionxuf.entity.Projectinfo;
import com.unionx.unionxuf.localdao.ProjectinfoMapper;

@Service("ProjectInfoService")
public class ProjectInfoServiceImpl implements ProjectInfoService {

	@Autowired
	private ProjectinfoMapper pm;
	
	@Override
	public Object getmx(String xiangmu) {
	
		List<Projectinfo> mz = pm.selectByPt(xiangmu);
		Map<String,Object> map =  new HashMap<String,Object>();
		map.put("data", mz);
		return map;
	}

	@Override
	public Object getPr(String xiaofei, String xiangmu, String mingxi) {
		// TODO Auto-generated method stub
		
		ProjectDTD p = new ProjectDTD();
		p.setMx(mingxi);
		p.setXiaofei(xiaofei);
		p.setXiangmu(xiangmu);
		String price = pm.selectByPrice(p);
		Map<String,Object> map =  new HashMap<String,Object>();
		map.put("data", price);
		return map;
	}

	

	@Override
	public Object delPr(String xiaofei, String xiangmu, String cropid) {
		// TODO Auto-generated method stub
		Map<String,Object>  map = new HashMap<String,Object>();
		Projectinfo p = new Projectinfo();
		p.setConsumeclass(xiaofei);
		p.setProjecttype(xiangmu);
		p.setCropid(cropid);
		int  i = pm.delPr(p);
		map.put("status", i);
		return map;
	}

	@Override
	public int insertPr(Projectinfo p) {
		// TODO Auto-generated method stub

			int i = pm.insert(p);
			
			return  i;
	
	}

	@Override
	public Object selectpro(String cropid) {
		// TODO Auto-generated method stub
		List<Projectinfo> list = pm.selectpro(cropid);
				
		return list;
	}



}
